# [151. 翻转字符串里的单词 - 力扣（LeetCode）](https://leetcode-cn.com/problems/reverse-words-in-a-string/)


class Solution:
    def reverseWords(self, s: str) -> str:
        data = s.split()
        data.reverse()
        return " ".join(data)


def test():
    """
    输入: "the sky is blue"
    输出: "blue is sky the"
    """
    assert Solution().reverseWords("the sky is blue") == "blue is sky the"


def test1():
    assert Solution().reverseWords("  hello world!  ") == "world! hello"


def test2():
    assert Solution().reverseWords("") == ""
